//
// Created by 喵喵乐 on 2023/4/22.
//

#ifndef CMAKECXX_STOCK_H
#define CMAKECXX_STOCK_H

#include <string>

class Stock {
private:
    std::string company;
    int shares;
    double share_val;
    double total_val;

    void set_tot() {
        total_val = share_val * shares;
    }

public:
    Stock();

    Stock(const std::string &str, long n = 0, double pr = 0.0);

    ~Stock();

    void buy(long num, double price);

    void sell(long num, double price);

    void update(double price);

    void show() const;

    const Stock &topval(const Stock &s) const;
};


#endif //CMAKECXX_STOCK_H
